/*
 * FalseEscWarningArrayElementType.java
 * 
 * Copyright 2008 Christoph Csallner and Yannis Smaragdakis.
 */
package edu.gatech.cc.cnc.examples;

/**
 * @author csallner@gatech.edu (Christoph Csallner)
 */
public class FalseEscWarningArrayElementType {

	public class A { /* empty */ }
	public class B extends A { /* empty */ }
	
	
	/**
	 * ESC/Java makes conservative assumptions on dynamic array element 
	 * types, and produces here a spurious warning about an illegal
	 * type cast.
	 */
	public void noBug() {
		A[] arr = new A[]{new B(), new A()};
		B b = (B) arr[0];
	}
	
	
	/**
	 * Here ESC/Java correctly does not produce a warning.
	 */
	public void noBugSimpler() {
		A[] arr = new B[]{new B()};
		B b = (B) arr[0];
	}
}
